﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.YWGZ
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.YWGZ;

    /// <summary>
    /// 中标盖章
    /// </summary>
    public class wf_zbgz_Map : EntityMapping<wf_zbgz>
    {
        public wf_zbgz_Map()
        {
            Property(x => x.FlowRecordId, map => map.Length(40));
            Property(x => x.gzCount);
            Property(x => x.gzLX, map => map.Length(10000));
            Property(x => x.gzNumber, map => map.Length(10));
            Property(x => x.gzDescribe, map => map.Length(10000));
            Property(x => x.WTValue);
            Property(x => x.WinDate);
            Property(x => x.SPDate);
            Property(x => x.SPFlag);
            Property(x => x.SPDescribe, map => map.Length(10000));
            Property(x => x.FlowRecordId, map => map.Length(40));
            Property(x => x.gzSubject, map => map.Length(200));


            //盖章申请与项目映射
            Bag(x => x.gzProjects, map =>
            {
                map.Table("ref_ZBGZ_to_Projects");
                map.Key(keyMapper => keyMapper.Column("GZId"));
            }, act => act.ManyToMany(m => m.Column("ProjectId")));


            //申请人
            ManyToOne(x => x.SQUser, map =>
            {
                map.Column("SqUserId");
                map.NotNullable(false);
            });
        }
    }
}
